﻿using Abp.Dependency;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GN.Pay.Core.Runtime.Caching.Impl
{
    /// <summary>
    /// 
    /// </summary>
    class CacheManager : ICacheManager
    {
        private readonly IIocManager iocManager;

        public CacheManager(IIocManager iocManager)
        {
            this.iocManager = iocManager;
        }

        public IBaseCache GetCache(string name)
        {
            return iocManager.Resolve<IBaseCache>(new { name });
        }

        /// <summary>
        /// 获取缓存
        /// </summary>
        /// <param name="cacheType">类型</param>
        /// <returns></returns>
        public IBaseCache GetCache(CacheType cacheType)
        {
            return GetCache(cacheType.ToString());
        }
    }
}
